﻿@model IList<GADC.Domain.Ranking>
<div style="height: 40px; line-height: 40px; padding: 0 10px;">
    <div class="pull-right" style="height: 40px; line-height: 40px;">
        <a href="@Url.Action("Edit", new { type = Request.QueryString["type"] })" class="btn  btn-primary btn-large"><i class="icon-plus-sign icon-white">
        </i>新增</a>
    </div>
    <div style="height: 40px; line-height: 40px;">
        <h2 id="bigTitle">
            @ViewBag.Title
        </h2>
    </div>
</div>
<hr />
@Html.Partial("MessageTip")

<table class="table table-bordered">
    <thead>
        <tr>
            <th align="center">
                名称
            </th>
            <th align="center">
                URL
            </th>
            <th align="center">
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (GADC.Domain.Ranking obj in Model)
        {
            <tr>
                <td>
                    @obj.Name
                </td>
                <td>
                    @obj.URL
                </td>
                <td>
                    <a class="operate" href="javascript:Operating(1,@obj.ID)">置顶</a>
                    @if (obj.Seq != null)
                    {
                        <a class="operate toptr" href="javascript:Operating(2,@obj.ID)">取消置顶</a>
                    }
                    <br />
                    <a class="operate" href='@Url.Action("Edit", new { id = obj.ID, type = Request.QueryString["type"] })'>编辑</a>
                    <a class="operate" href="javascript:Operating(-1,@obj.ID)">删除</a>
                    <br />
                </td>
            </tr>
        }
    </tbody>
</table>
<form id="hideForm" action='@Url.Action("Operate", new { type = Request.QueryString["type"] })' method="post">
<input type="hidden" id="Operate" name="Operate" />
<input type="hidden" id="ID" name="ID" />
</form>
@section scripts{
    <script type="text/javascript">
        function Operating(operateType, id) {
            if (operateType == -1) {
                if (!window.confirm("确定删除该图片?")) {
                    return false;
                }
            }

            $("#Operate").val(operateType);
            $("#ID").val(id);
            $("#hideForm").submit();
        }
    </script>
}
